package it.xiuxian.personcenter.presenter

import com.alibaba.android.arouter.launcher.ARouter
import com.lzy.okgo.OkGo
import it.xiuxian.lib.base.*
import it.xiuxian.lib.http.CallBackOption
import it.xiuxian.lib.http.HttpConfig
import it.xiuxian.lib.http.SPConfig
import it.xiuxian.lib.utils.EncodeUtils
import it.xiuxian.lib.utils.SPUtil
import it.xiuxian.lib.utils.ToastUtil
import it.xiuxian.personcenter.bean.DetailListBean
import it.xiuxian.personcenter.fragment.RecordFragment
import org.json.JSONObject

class RecordFragmentPresenter:BasePresenter<RecordFragment>() {
    fun getDetail(pageNo:String,leixing:String){
        var json1 = JSONObject()
        json1.put("pageNo",pageNo)
            .put("leixing",leixing)
        OkGo.post<BaseBean<DetailListBean>>(HttpConfig.BASE_URL+"/appmingxi/list")
            .params("encrypt", EncodeUtils.encodeAES(json1.toString()))
            .execute(object : CallBackOption<BaseBean<DetailListBean>>() {}.loadBind(mView as RecordFragment).execute(
                object : ILoadBind<BaseBean<DetailListBean>> {
                    override fun excute(bean: BaseBean<DetailListBean>) {
                        if(bean.code==0){
                            //ToastUtil.showShort(bean.msg)
                            (mView as RecordFragment).setData(bean.data)

                        }
                    }
                }
            ))
    }
}